package cn.bigfire.wedesk.util;

import cn.bigfire.wedesk.bean.Wedesk;
import cn.bigfire.wedesk.net.protocol.Protocol;
import io.netty.channel.Channel;

public class PackUtil {

    public static Channel channel;

    public static void ping(){
        if (channel != null) {
            channel.writeAndFlush(Protocol.of(Wedesk.Cmd.CMD_PING, new Wedesk.Empty()));
        }
    }

    public static void heart(){
        if (channel != null) {
            channel.writeAndFlush(Protocol.of(Wedesk.Cmd.CMD_HEART, new Wedesk.Empty()));
        }
    }

    public static void pcInfo(){
        if (channel != null) {
            channel.writeAndFlush(Protocol.of(Wedesk.Cmd.CMD_PC_INFO, PCInfoUtil.pcInfo));
        }
    }

    public static void register(Wedesk.RegisterReq registerReq){
        if (channel != null) {
            channel.writeAndFlush(Protocol.of(Wedesk.Cmd.CMD_REGISTER, registerReq));
        }
    }

    public static void login(Wedesk.LoginReq loginReq){
        if (channel != null) {
            channel.writeAndFlush(Protocol.of(Wedesk.Cmd.CMD_LOGIN, loginReq));
        }
    }

    public static void ctrlList(){
        if (channel != null) {
            channel.writeAndFlush(Protocol.of(Wedesk.Cmd.CMD_CTRL_MY_LIST, new Wedesk.Empty()));
        }
    }

    public static void ctrlOpen(Wedesk.Ctrl ctrl){
        if (channel != null) {
            channel.writeAndFlush(Protocol.of(Wedesk.Cmd.CMD_CTRL_OPEN, ctrl));
        }
    }

    public static void sendImgData(Wedesk.ScreensHot screensHot){
        if (channel != null) {
            channel.writeAndFlush(Protocol.of(Wedesk.Cmd.CMD_SCREENSHOT_DATA, screensHot));
        }
    }

    public static void ctrlClose(Wedesk.Ctrl ctrl){
        if (channel != null) {
            channel.writeAndFlush(Protocol.of(Wedesk.Cmd.CMD_CTRL_CLOSE, ctrl));
        }
    }




}
